<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 //EN">
<html lang="en">
<head>
    <title>Gregphoto_Image Overview</title>
    <style>
	body {
	    font-family: Arial, Verdana, sans-serif;
	    font-size: 12px;
	}
	body {
	    background: #FEFFBF;
	}
	#pageContents {
	   margin: auto;
	   width: 600px;
	   background: #FFFFDE;
	   border: 1px solid #000000;
	   padding: 10px 5px;
	}
	pre.code {
	    border: 1px dotted #8F7500;
	    padding: 3px;
	    background: #FFFFDF;
	    margin: 10px 20px;
	    font-family: monospace;
	    font-size: 12px;
	}
	h1,h2,h3 {
	    color: #8F7500;
	}
	h1 {
	    text-align: center;
	}
	h3 {
	    border-bottom: 1px solid #8F7500;
	}
	h2 {
	    font-size: 20px;
	    border: 1px solid #8F7500;
	    border-left: 10px solid #8F7500;
	    border-right: 10px solid #8F7500;
	    background: #FFFFFF;
	    padding: 0 0 0 5px;
	}
    </style>
</head>
<body>
<h1>Gregphoto_Image Overview</h1>
<div id="pageContents">
<h2>THE BASICS</h2>
<h3>Overview</h3>
Gregphoto_Image is a PHP class that aims to simplify the process of generating thumbnail images
in the JPEG, PNG, and GIF formats.  Images can either be rendered directly to the screen or saved
to the filesystem.

<h3>Prerequisites</h3>
<ul>
    <li>PHP version 5 or greater - the class uses PHP5 specific language features such as
    exceptions, destructors, and public/private methods.</li>
    <li>The GD2 PHP extension - the class performs all image manipulation.  While there are other
    graphics libraries available for PHP, I chose to use GD2 because it ships as a part of PHP5
    and works well across platforms</li>
</ul>

<h3>Features</h3>
<ul>
    <li>Ability to read JPEG, PNG, or GIF images</li>
    <li>Ability to output JPEG, PNG, or GIF images</li>
    <li>4 modes of thumbnail creation
	<ul>
	    <li><i>MAX_HEIGHT</i> - you specify a maximum height and the dimensions are calculated based off of the height</li>
	    <li><i>MAX_WIDTH</i> - you specify a maximum width and the dimensions are calculated based off of the width</li>
	    <li><i>BEST_FIT</i> - you specify a maximum height and width and the dimensions are calculated so that the thumbnail
	    is as large as possible without exceeding the maximum height or width</li>
	    <li><i>EXACT</i> - you specify a maximum height and width and these are directly used.  Causes distortion if the
	    chosen aspect ratio is different from the aspect ratio of the image</li>
	</ul>
    </li>
    <li>Renders/saves images in their input format by default, but allows changing the format.  For example, input a GIF but output
    a PNG</li>
    <li>Fully documented object oriented code</li>
    <li>Fluent interface for creating thumbnails with a minimal amount of code</li>
</ul>

<h3>License</h3>
This class is licensed under the <a href="http://www.opensource.org/licenses/mit-license.php">MIT license</a>.  Do with it what you will...

<h3>Getting it</h3>
Gregphoto_Image is available on Google Code in the <a href="http://code.google.com/p/gregphotoimage/">Gregphoto_Image Project</a>

<h2>SAMPLE USAGE</h2>
<h3>Rendering thumbnails to the browser</h3>
In this example, a file is loaded from the file system and is resized to a maximum height of 100 and a maximum
width of 150 with a quality of 90 (out of 100_.  It is then rendered to the browser:

<pre class="code">
require('path/to/Gregphoto_Image.php');
$image = new Gregphoto_Image('path/to/sample/image.jpg');
$image-&gt;setMaxHeight(200);
$image-&gt;setMaxWidth(200);
$image-&gt;setJpegQuality(90);
$image-&gt;resize(Gregphoto_Image::BEST_FIT);
$image-&gt;showThumbnail();
</pre>

<h3>Saving thumbnails to the filesystem and setting the output file type</h3>
The following shows the same manipulation, but instead it is saved to a file and it is output in a different image format.
The output type can be one of the following three constants: IMAGETYPE_JPEG, IMAGETYPE_GIF, or IMAGETYPE_PNG

<pre class="code">
require('path/to/Gregphoto_Image.php');
$image = new Gregphoto_Image('path/to/image.jpg');
$image-&gt;setMaxHeight(200);
$image-&gt;setMaxWidth(200);
$image-&gt;setJpegQuality(90);
$image-&gt;setOutputType(IMAGETYPE_PNG);
$image-&gt;resize(Gregphoto_Image::BEST_FIT);
$image-&gt;saveThumbnail('path/to/thumbnail.png');
</pre>

<h3>More Examples</h3>
See the 'samples' directory of the distribution for more examples including:
<ul>
    <li>Examples of all 4 resizing types</li>
    <li>Examples of outputing images to the browser</li>
    <li>Example of a simple gallery that dynamically shows thumbnails and a main image</li>
    <li>Example of a simple gallery that caches images to the filesystem the first time they are requested</li>
    <li>Example of using the fluent interface</li>
</ul>
</div>
</body>
</html>